{extend name="shop/blue/base" /}
{block name="resources"}
<!-- 添加css、字体文件文件 -->
<link type="text/css" rel="stylesheet" href="__TEMP__/{$style}/public/css/ns_sale.css">
<link type="text/css" rel="stylesheet" href="__TEMP__/{$style}/public/css/ns_default.css">
<link rel="stylesheet" type="text/css" href="__TEMP__/{$style}/public/css/ns_shop_common.css">
<style>
ul.list-grid .item {
    float: left;
    font-size: 12px;
    width: 232px;
    margin: 15px 10px 0 0;
    padding: 1px;
}
.tip-box{
    width: 100%;
    text-align: center;
    margin: 80px auto;
}
.tag-small-block{position:absolute;z-index:100;width:82px !important;line-height:29px;background-repeat:no-repeat;top:0;left:0;color:#FFF;font-size:12px;}
.tag-small-block span{display:block;text-align: center;position: absolute;top: 5px;width:91%;left:-16px;transform: rotate(314.8deg);-ms-transform: rotate314.8deg);-webkit-transform: rotate(314.8deg);}
</style>
{/block}
{block name="main"}
	{include file='shop/blue/controlBrandSale' ap_id='6666'/}
	<div class="w1210">
		<div class="sale-container">
			<!-- 促销类别列表 -->
			{notempty name="groupList"}
			<div class="sale-middle">
				<div class="pinpaijngxuan_pro_head">
					<div class="pinpaijngxuan_pro_title">
						<div class="brand-showcase-list" id="brand-list">
							<ul style="width: 1092px; position: relative; height: 100%;">
								{volist name="groupList" id="type"}
								{if condition="$type.group_id eq $group_id"}
								<li class="current">
								{else/}
								<li>
								{/if}
									<a href="javascript:categoryHref({$type.group_id});" title="{$type.group_name}" id="{$type.group_id}">{$type.group_name}</a>
								</li>
								{/volist}
							</ul>
						</div>
						<div class="brand-showcase-page" id="showcase-page">
							<a href="javascript:;" class="focus-btn focus-prev font-song" id="j-focus-prev" data-btn="tlRight"></a>
							<a href="javascript:;" class="focus-btn focus-next font-song" id="j-focus-next" data-btn="tlLeft"></a>
						</div>
					</div>
				</div>
			</div>
			{/notempty}
			<div class="wrapper">
				{notempty name="goods_list['data']"}
				<ul class="list-grid clearfix js-list-grid">
					{foreach name="goods_list['data']" item="goods" key="k"}
					<li class="item {if condition='$k neq 0 && ($k+1)%5==0'}last{/if}">
						<div class="item-con">
							<div class="item-pic">
								<a href="{:__URL('SHOP_MAIN/goods/goodsinfo','goodsid='.$goods['goods_id'])}" title="{$goods.goods_name}" target="_blank">
									<img src="{:__IMG($default_goods_img)}" class="lazy_load" data-original="{:__IMG($goods['pic_cover_mid'])}">
								</a>
							</div>
							{notempty name="$curr_group['group_id']"}
							<div class="tag-small-block" style="overflow: hidden;">
								{if condition="$curr_group['picture']['pic_cover']!=''"}
								<img src="{:__IMG($curr_group['picture']['pic_cover'])}"/>
								{else/}
								<img src="__TEMP__/{$style}/public/images/merchandising_label.png"/>
								<span>{$curr_group.group_name}</span>
								{/if}
							</div>
							{/notempty}
							<div class="item-info">
								<div class="item-price"><em class="sale-price money-color">{$goods.display_price}</em></div>
								<div class="item-name"><a href="{:__URL('SHOP_MAIN/goods/goodsinfo','goodsid='.$goods['goods_id'])}" target="_blank" title="{$goods.goods_name}">{$goods.goods_name}</a></div>
								<div class="item-con-info">
									<div class="fr" style="float: left;margin-right: 5px;">
										<div class="item-add-cart">
										{in name="$goods['point_exchange_type']" value="0,2"}
											{if condition="$goods['goods_type'] == 1 "}
												{if condition="$goods['is_open_presell'] == 0 "}
													<!-- 实物商品 -->
													{if condition="$goods['stock'] neq '0'"}
														<a href="javascript:ShowGoodsAttribute({$goods.goods_id},'{$goods.goods_name}',{$goods.pic_id},this,{if condition='$goods.max_buy==0' }{$goods.stock}{else/}{$goods.max_buy}{/if},{$goods.state});" class="add-cart" title="{:lang('goods_add_cart')}"><i class="icon-cart"></i>{:lang('goods_add_cart')}</a>
													{else /}
														<a href="javascript:;" class="add-cart" title="{:lang('goods_add_cart')}" style="background: #bbb;"><i class="icon-cart"></i>{:lang('goods_add_cart')}</a>
													{/if}
												{else/}
													<a href="{:__URL('SHOP_MAIN/goods/goodsinfo','goodsid='.$goods['goods_id'])}" target="_blank" class="add-cart" title="{:lang('view_details')}">{:lang('view_details')}</a>
												{/if}
											{else/}
												<!-- 虚拟商品，没有加入购物车 -->
												<a href="{:__URL('SHOP_MAIN/goods/goodsinfo','goodsid='.$goods['goods_id'])}" target="_blank" class="add-cart" title="{:lang('view_details')}">{:lang('view_details')}</a>
											{/if}
										{else/}
											<a href="{:__URL('SHOP_MAIN/goods/goodsInfoPointExchange','goodsid='.$goods['goods_id'])}" target="_blank" class="action-btn addcart-btn add-cart" title="{:lang('goods_exchange')}">{:lang('goods_exchange')}</a>
										{/in}
										</div>
									</div>
									<div class="fl">
										<div class="item-operate {if condition="$goods.is_favorite>0"}is_favorite{/if}">
												<a href="javascript:;" class="operate-btn collet-btn  goods-collect" onclick="collectionGoods({$goods.goods_id},'goods','{$goods.goods_name}',this,false)">
												<i {if condition="$goods.is_favorite>0"}style="background-position:-107px -11px;"{/if} data-log-id="{$goods.is_favorite}"></i>
												<span style="display: inline;"> {if condition="$goods.is_favorite>0"}{:lang('goods_collected')}
							 							{else/}{:lang('goods_collection')}{/if}
							 					</span>
											</a>
											<!-- <a href="{:__URL('SHOP_MAIN/goods/goodsinfo','goodsid='.$goods['goods_id'].'#goods_evaluate')}" target="_blank" class="operate-btn comment-btn"><i></i> {$goods.evaluates}</a> -->
										</div>
									</div>
									{if condition="$custom_service['value']['service_addr'] != '' "}
									<a href="{$custom_service['value']['service_addr']}" title="{:lang('contact_customer_service')}" target="_blank" class="customerService">
										<i class="kefu"></i>
									</a>
									{/if}
								</div>
							</div>
						</div>
					</li>
					{/foreach}


				</ul>
				{else/}
				<div class="tip-box" style="position: static;">
					<i class="tip-icon"></i>
					<div class="tip-text">{:lang('sorry')}！{:lang('no_result_you_want')}……</div>
				</div>
				{/notempty}
			</div>
				{include file='shop/blue/controlCommonPage'/}
		</div>
		{include file='shop/blue/controlLoveOrHistory' /}
	</div>
	{include file='shop/blue/Goods/controlPopUpGoodsSkuAttribute'/}
{/block}
{block name="javascript"}
<script type="text/javascript" src="__TEMP__/{$style}/public/js/ns_index.js"></script>
<script src="__TEMP__/{$style}/public/js/goods/controlGoods.js"></script>
<script src="__TEMP__/{$style}/public/js/ns_collections.js" type="text/javascript"></script>
<script type="text/javascript">
/**
 * 计算每次偏移值
 */
$(function(){
	var d_li=$('.pinpaijngxuan_pro_title li');
	var li_count=d_li.length;
	var d_width=d_li.width();
	$('.brand-showcase-list>ul').css('width',li_count*d_width+'px');
	$('.focus-next').click(function(){
		var this_left=$('.brand-showcase-list>ul').css('left');
		this_left=this_left=='auto' ? 0: this_left;
		var width_len=(li_count-5)*d_width;
		if(this_left!='0'){
			this_left=this_left.substr(1,this_left.length-3);
		}
		if(this_left>=width_len)return false;
		var left=Number(this_left)+Number(d_width);
		$('.brand-showcase-list>ul').css('left','-'+left+'px');
	})
	$('.focus-prev').click(function(){
		var this_left=$('.brand-showcase-list>ul').css('left');
		this_left=this_left=='auto' ? 0: this_left;
		if(this_left!='0'){
			this_left=this_left.substr(1,this_left.length-3);
			
		}
		var left=Number(this_left)-Number(d_width);
		$('.brand-showcase-list>ul').css('left','-'+left+'px');
	})
})
/* *
 * 搜索分类下的品牌,传所选中li的id值和左偏移量 
 */
function categoryHref(group_id)
{
	var this_left=$('.brand-showcase-list>ul').css('left');
	location.href=__URL("SHOP_MAIN/goods/promotionZone?group_id="+group_id+"&left="+this_left);
}
</script>
{/block}